// Copyright (c) 2005  INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of cgal-python; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; version 2.1 of the License.
// See the file LICENSE.LGPL distributed with cgal-python.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $Id: Py_Iso_cuboid_3.cpp 167 2007-11-02 15:36:54Z spion $
// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal-python/trunk/cgal-python/bindings/Kernel/Py_Iso_cuboid_3.cpp $
//
// Author(s)     : Naceur Meskini and Sylvain Pion
//=========================================================================

#include <CGAL/basic.h>
#include <include/Kernels.h>

#include <boost/python.hpp>
#include <boost/cstdint.hpp>

const char* Iso_cuboid_3_doc[]={
"An object s of the data type Iso_cuboid_3 is a cuboid in the three-dimentional Euclidean space\n\
with edges parallel to the x, y and z axis of the coordinate system.\n\
Although they are represented in a canonical form by only two vertices, namely the lexicographically\n\
smallest and largest vertex with respect to Cartesian xyz coordinates, we provide functions for \n\
``accessing'' the other vertices as well.\n\
Iso-oriented cuboids and bounding boxes are quite similar. The difference however is that bounding \n\
boxes have always double coordinates, whereas the coordinate type of an iso-oriented cuboid is chosen by the user. \n\
For more details see a C++ documentation:\n\
http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Kernel_23_ref/Class_Iso_cuboid_3.html",
"c = Iso_cuboid_3( Point_3 p, Point_3 q)\n\
introduces an iso-oriented cuboid c with diagonal opposite vertices p and q. \n\
Note that the object is brought in the canonical form.\n\n\
c = Iso_cuboid_3( Point_3 left,Point_3 right,Point_3 bottom,Point_3 top,Point_3 far,Point_3 close)\n\
introduces an iso-oriented cuboid c whose minimal x coordinate is the one of left, the maximal x coordinate \n\
is the one of right, the minimal y coordinate is the one of bottom, the maximal y coordinate is the one of top, \n\
the minimal z coordinate is the one of far, the maximal z coordinate is the one of close.\n\n\
c = Iso_cuboid_3( min_hx,min_hy,min_hz,max_hx,max_hy,max_hz,hw = 1)\n\
introduces an iso-oriented cuboid c with diagonal opposite vertices (min_hx/hw, min_hy/hw, min_hz/hw) and (max_hx/hw, max_hy/hw, max_hz/hw).\n\
Precondition: hw # 0.",

"c.min(self) -> Point_3\nreturns the smallest vertex of c (= vertex(0)).",

"c.max(self) -> Point_3\nreturns the largest vertex of c (= vertex(7)).",

"c.vertex(self,int i) -> Point_3\nreturns the i'th vertex modulo 8 of c. starting with the lower left vertex.",

"c.transform(self, Aff_transformation_3 t) -> Iso_cuboid_3\n\
returns the iso-oriented cuboid obtained by applying t on the smallest and the largest of c.\n\
Precondition: The angle at a rotation must be a multiple of pi/2, otherwise the resulting \n\
cuboid does not have the same size. Note that rotating about an arbitrary angle can even result\n\
in a degenerate iso-oriented cuboid.",

"c.bounded_side(self,Point_3 p) -> Bounded_side\n\
returns either ON_UNBOUNDED_SIDE, ON_BOUNDED_SIDE, or the constant ON_BOUNDARY, depending on where point p is.",

"c.has_on_boundary(self,Point_3 p) ->bool",

"c.has_on_bounded_side(self,Point_3 p) ->bool",

"c.has_on_unbounded_side(self,Point_3 p) ->bool",

"c.is_degenerate(self) ->bool\nc is degenerate, if all vertices are collinear.",

"c.bbox(self) -> Bbox\nreturns a bounding box containing c. ",

"c.xmin(self) -> double\nreturns smallest Cartesian x-coordinate in c.",
"c.ymin(self) -> double\nreturns smallest Cartesian y-coordinate in c.",
"c.zmin(self) -> double\nreturns smallest Cartesian z-coordinate in c.",
"c.xmax(self) -> double\nreturns largest Cartesian x-coordinate in c.",
"c.ymax(self) -> double\nreturns largest Cartesian y-coordinate in c.",
"c.zmax(self) -> double\nreturns largest Cartesian z-coordinate in c.",
"c.min_coord(self,int i) ->double\nreturns i-th Cartesian coordinate of the smallest vertex of c.\n\
Precondition: 0 <= i <= 2.",
"c.max_coord(self,int i) ->double\nreturns i-th Cartesian coordinate of the largest vertex of c.\n\
Precondition: 0 <= i <= 2.",
"c.volume(self) -> double\nreturns the volume of c."
};


template <class kernel > 
void Py_Iso_cuboid_3()
{
	typedef typename kernel::Point_3 						Point_3;
 	typedef typename kernel::Iso_cuboid_3 						Iso_cuboid_3;
	typedef typename kernel::FT 							FT;

	using namespace boost::python;

	class_< Iso_cuboid_3 >("Iso_cuboid_3", Iso_cuboid_3_doc[0], init<>())
        .def(init< const Iso_cuboid_3& >(Iso_cuboid_3_doc[1]))
        .def(init< const Point_3&, const Point_3& >())
        .def(init< const Point_3&, const Point_3&, const Point_3&, const Point_3&, const Point_3&, const Point_3& >())
        .def(init< const FT&, const FT&, const FT&, const FT&, const FT&, const FT& >())
        .def(init< const FT&, const FT&, const FT&, const FT&, const FT&, const FT&, const FT& >())
        .def(init< const double&, const double&, const double&, const double&, const double&, const double& >())
        .def(init< const double&, const double&, const double&, const double&, const double&, const double&, const double& >())

        .def("min", &Iso_cuboid_3::min, BEF_33(by_cref, by_copy)(), Iso_cuboid_3_doc[2])
        .def("max", &Iso_cuboid_3::max, BEF_33(by_cref, by_copy)(), Iso_cuboid_3_doc[3])
        .def("vertex", &Iso_cuboid_3::vertex, Iso_cuboid_3_doc[4])
#if CGAL_VERSION_NR < 1030301000 || CGAL_VERSION_NR >= 1030401000 || defined CGAL_DONT_USE_LAZY_KERNEL
        .def("transform", &Iso_cuboid_3::transform, Iso_cuboid_3_doc[5]) // was forgotten in 3.3.
#endif
        .def("bounded_side", &Iso_cuboid_3::bounded_side, Iso_cuboid_3_doc[6])
//         .def("has_on", &Iso_cuboid_3::has_on)
        .def("has_on_boundary", &Iso_cuboid_3::has_on_boundary, Iso_cuboid_3_doc[7])
        .def("has_on_bounded_side", &Iso_cuboid_3::has_on_bounded_side, Iso_cuboid_3_doc[8])
        .def("has_on_unbounded_side", &Iso_cuboid_3::has_on_unbounded_side, Iso_cuboid_3_doc[9])
        .def("is_degenerate", &Iso_cuboid_3::is_degenerate, Iso_cuboid_3_doc[10])
        .def("bbox", &Iso_cuboid_3::bbox, Iso_cuboid_3_doc[11])
#if CGAL_VERSION_NR < 1030301000
        .def("xmin", &Iso_cuboid_3::xmin, by_cref(), Iso_cuboid_3_doc[12])
        .def("ymin", &Iso_cuboid_3::ymin, by_cref(), Iso_cuboid_3_doc[13])
        .def("zmin", &Iso_cuboid_3::zmin, by_cref(), Iso_cuboid_3_doc[14])
        .def("xmax", &Iso_cuboid_3::xmax, by_cref(), Iso_cuboid_3_doc[15])
        .def("ymax", &Iso_cuboid_3::ymax, by_cref(), Iso_cuboid_3_doc[16])
        .def("zmax", &Iso_cuboid_3::zmax, by_cref(), Iso_cuboid_3_doc[17])
        .def("min_coord", &Iso_cuboid_3::min_coord, by_cref(), Iso_cuboid_3_doc[18])
        .def("max_coord", &Iso_cuboid_3::max_coord, by_cref(), Iso_cuboid_3_doc[19])
#else
        .def("xmin", &Iso_cuboid_3::xmin, typename Value_or_cref<typename kernel::Compute_xmin_3, Iso_cuboid_3 > ::type(), Iso_cuboid_3_doc[12])
        .def("ymin", &Iso_cuboid_3::ymin, typename Value_or_cref<typename kernel::Compute_ymin_3, Iso_cuboid_3 > ::type(), Iso_cuboid_3_doc[13])
        .def("zmin", &Iso_cuboid_3::zmin, typename Value_or_cref<typename kernel::Compute_zmin_3, Iso_cuboid_3 > ::type(), Iso_cuboid_3_doc[14])
        .def("xmax", &Iso_cuboid_3::xmax, typename Value_or_cref<typename kernel::Compute_xmax_3, Iso_cuboid_3 > ::type(), Iso_cuboid_3_doc[15])
        .def("ymax", &Iso_cuboid_3::ymax, typename Value_or_cref<typename kernel::Compute_ymax_3, Iso_cuboid_3 > ::type(), Iso_cuboid_3_doc[16])
        .def("zmax", &Iso_cuboid_3::zmax, typename Value_or_cref<typename kernel::Compute_zmax_3, Iso_cuboid_3 > ::type(), Iso_cuboid_3_doc[17])
        .def("min_coord", &Iso_cuboid_3::min_coord, typename Value_or_cref<typename kernel::Compute_xmin_3, Iso_cuboid_3 > ::type(), Iso_cuboid_3_doc[18])
        .def("max_coord", &Iso_cuboid_3::max_coord, typename Value_or_cref<typename kernel::Compute_xmax_3, Iso_cuboid_3 > ::type(), Iso_cuboid_3_doc[19])
#endif
        .def("volume", &Iso_cuboid_3::volume)
        .def( self == self )
        .def( self != self )
	;
}


void export_Iso_cuboid_3()
{
	Py_Iso_cuboid_3<K>();
}
